﻿using System;
using System.Configuration;
using System.Web;

namespace MyOrganizer.Pages
{
    public partial class SiteMain : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblName.Text = Session["UserName"].ToString();
        }

        protected void lnkMovies_Click(object sender, EventArgs e)
        {
            Response.RedirectToRoute("Movies");
        }

        protected void lnkHome_Click(object sender, EventArgs e)
        {
            Response.RedirectToRoute("Home");
        }

        protected void lnkAccountInfo_Click(object sender, EventArgs e)
        {
            Response.RedirectToRoute("Account");
        }

        protected void lnkCalendar_Click(object sender, EventArgs e)
        {
            Response.RedirectToRoute("Calendar");
        }

        protected void lnkBooks_Click(object sender, EventArgs e)
        {
            Response.RedirectToRoute("Books");
        }

        protected void lnkTvShows_Click(object sender, EventArgs e)
        {
            Response.RedirectToRoute("TvShows");
        }

        protected void btnLogOut_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            if (Request.Cookies[ConfigurationManager.AppSettings["CookieName"].ToString()] != null)
            {
                HttpCookie Cookie = Request.Cookies[ConfigurationManager.AppSettings["CookieName"].ToString()];
                Cookie.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(Cookie);
            }
            Response.RedirectToRoute("Login");
        }
    }
}